import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import static java.lang.Thread.sleep;

public class Test2 {
    public static void main(String[] args) throws InterruptedException {
        WebDriver webDriver=new ChromeDriver();

        webDriver.get("https://www.baidu.com/");
        webDriver.manage().window().maximize();
        sleep(300);
        webDriver.findElement(By.cssSelector("#kw")).sendKeys("老虎");
        sleep(300);
        webDriver.findElement(By.cssSelector("#kw")).clear();
        webDriver.findElement(By.cssSelector("#result_logo > img.index-logo-src")).click();
        String s=webDriver.findElement(By.cssSelector("#s-top-left > a:nth-child(1)")).getText();
        System.out.println(s);
    }
}
